#ifndef _TASKQUEUE_H
#define _TASKQUEUE_H

#include <stdio.h>
#include <queue>
#include <condition_variable>
#include <mutex>
#include <functional>
using std::mutex;
using std::condition_variable;
using std::unique_lock;
using std::function;
using TASK=function<void()>;


using ElemType = TASK;
using std::queue;

class TaskQueue
{
public:
 
    TaskQueue(size_t queCapacity);

    void push( ElemType val);

    ~TaskQueue();

    ElemType pop();

    bool isFull();

    bool isEmpty();

    void wakeup();

private:
    size_t _capacity;
    queue<ElemType> _que;
    mutex _mutex;
    condition_variable _notFull;
    condition_variable _notEmpty;
    bool _flag;
};

#endif 